package com.liuyou.main;


import com.liuyou.weather4.BaiduWebsite;
import com.liuyou.weather4.WeatherData;

public class Observer {
    public static void main(String[] args) {
        WeatherData weatherData = new WeatherData();
        BaiduWebsite baiduWebsite = new BaiduWebsite();
        weatherData.registerObserver(baiduWebsite);
        weatherData.setTemperature(20);
        weatherData.setPressure(100);
        weatherData.setHumidity(20);
        weatherData.notifyObserver();

        System.out.println(baiduWebsite);

        weatherData.setTemperature(21);
        System.out.println(baiduWebsite);
        weatherData.notifyObserver();
        System.out.println(baiduWebsite);
    }
}























/*package com.liuyou.main;


import com.liuyou.weather3.BaiduWeatherWebside;
import com.liuyou.weather3.WeatherData;
import com.liuyou.weather3.WebsideObserver;

public class Observer {
    public static void main(String[] args) {
        WeatherData weatherData = new WeatherData();

        BaiduWeatherWebside baiduWeatherWebside = new BaiduWeatherWebside();
        weatherData.registerObserver(baiduWeatherWebside);

        weatherData.setData(20, 100, 8);
    }
}*/





















/*package com.liuyou.main;


import com.liuyou.weather2.BaiduWebsite;
import com.liuyou.weather2.WeatherData;
import com.liuyou.weather2.WeatherWebsideCurrentCondition;

public class Observer {
    public static void main(String[] args) {
        WeatherData weatherData = new WeatherData();
        WeatherWebsideCurrentCondition weatherWebsideCurrentCondition = new WeatherWebsideCurrentCondition();
        weatherData.registerObserver(weatherWebsideCurrentCondition);

        BaiduWebsite baiduWebsite = new BaiduWebsite();
        weatherData.registerObserver(baiduWebsite);
        weatherData.removeObserver(weatherWebsideCurrentCondition);
        weatherData.setData(10, 100, 29);

    }
}*/


















/*
package com.liuyou.main;

import com.liuyou.weather.WeatherData;
import com.liuyou.weather.WeatherWebsideCurrentCondition;

public class Observer {
    public static void main(String[] args) {
        WeatherWebsideCurrentCondition weatherWebsideCurrentCondition = new WeatherWebsideCurrentCondition();
        WeatherData weatherData = new WeatherData(weatherWebsideCurrentCondition);
        weatherData.setData(30, 150, 40);
    }
}
*/
